import React, { Component } from 'react';
import { Link } from 'react-router-dom';

import './index.scss';

class NavItemCon extends Component {
  render () {
    const { index, curIdx, onNavItemClick, dataItem } = this.props;

    return (
      <div className={ ['nav-item', index === curIdx ? 'nav-current': ''].join(' ') }>
        <Link
          to= { '/'+ dataItem.field }
          onClick = { () => onNavItemClick(dataItem, index) }
        >
          { dataItem.title }
          <i className="iconfont iconyoujiantou"></i>
        </Link>
      </div>
    )
  }
}

export default NavItemCon;